﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>角色权限</title>
    <!-- Bootstrap -->
    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet">
    <link href="/JqueryPlug/dtGrid/jquery.dtGrid.css" rel="stylesheet">
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="/CSS/Base/Button.css" rel="stylesheet">
    <link href="/CSS/Base/BaseClass.css" rel="stylesheet">

    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
    <script src="/Scripts/avalon.js"></script>
    <script src="/Scripts/jquery-migrate-1.1.0.min.js"></script>
    <script src="/JqueryPlug/dtGrid/jquery.dtGrid.js"></script>

    <script src="/Scripts/SZHLCommon.js"></script>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script type="text/javascript">

        var model = avalon.define({
            $id: "ZWQX",
            RoleUserData: [],
            RoleData: [],
            SelRoleItem: {},
            GetUserList: function (item) {
                $.getJSON('/API/SZHLAPI.ashx?Action=GETROLEUSER', { "P1": item.RoleCode }, function (resultData) {
                    model.RoleUserData = resultData.Result;
                    model.SelRoleItem = item;
                })
            },
            GetRole:function(){
                $.getJSON('/API/SZHLAPI.ashx?Action=GETROLE', function (resultData) {
                    model.RoleData = resultData.Result;
                    model.GetUserList(model.SelRoleItem.$model);
                })
            },
            AddRole: function () {
                
                parent.ComFunJS.winviewform("/Admin/RoleAdd.html", "添加角色", "1000", "600");
            },
            EditRole: function () {
                if (model.SelRoleItem.$model.RoleCode != null && model.SelRoleItem.$model.RoleCode != "") {
                    parent.ComFunJS.winviewform("/Admin/RoleAdd.html?rolecode=" + model.SelRoleItem.$model.RoleCode, "修改角色", "1000", "600");
                }
            },
            DelRole: function () {
                $.post("/API/SZHLAPI.ashx", { Action: "DELROLE", P1: model.SelRoleItem.$model.RoleCode },
                function (result) {
                    if ($.trim(result.ErrorMsg) != "") {
                        parent.ComFunJS.winwarning(result.ErrorMsg);
                    } else {
                        parent.ComFunJS.winsuccess("删除" + model.SelRoleItem.$model.RoleName + "成功")
                        model.RoleData.remove(model.SelRoleItem);
                        model.SelRoleItem = model.RoleData[0];
                    }
                });
            }
        });
        avalon.ready(function () {
            //获取主要菜单
            $.getJSON('/API/SZHLAPI.ashx?Action=GETROLE', function (resultData) {
                model.RoleData = resultData.Result;
                model.GetUserList(model.RoleData.$model[0]);
            })
        })
      
    </script>
</head>
<body ms-controller="ZWQX" style="background-color:white">
    <div class="container-fluid maindiv" style="margin: 20px" id="dvContent">
        <div class="row">
            <div class="col-xs-2">
                <div class="panel panel-default">
                    <!-- Default panel contents -->
                    <div class="panel-heading">角色列表</div>
                    <div class="panel-body">
                        <p><a href="#" id="btADD" ms-click="AddRole()" style="  height: 34px;line-height: 34px;" class="button button-glow button-border button-rounded button-primary"><i class="fa fa-plus"></i>添加角色</a></p>
                    </div>

                    <!-- List group -->
                    <ul class="list-group">
                        <li class="list-group-item" ms-repeat-item="RoleData" ms-class="active:item.RoleCode==SelRoleItem.RoleCode" ms-click="GetUserList(item)"><span class="badge">{{item.userCount}}</span><span style="margin-left:10px;">{{item.RoleName}}</span></li>
                    </ul>

                </div>
            </div>
            <div class="col-xs-10">
                <div class="panel panel-default">
                    <!-- Default panel contents -->
                    <div class="panel-heading">角色详情<a href="#" id="btEdit" ms-click="DelRole()" class="" style=" line-height: 34px; float: right;  margin-top:-10px; ">删除角色</a><a href="#" id="btEdit" ms-click="EditRole()" class="" style=" line-height: 34px; float: right; margin-top: -10px; margin-right: 5px;">修改角色</a></div>
                    <div class="panel-body" ms-repeat-item="RoleUserData">
                        <dl>
                            <dt>角色名称：</dt>
                            <dd>{{item.RoleName}}</dd>
                        </dl>
                        <dl>
                            <dt>角色描述：</dt>
                            <dd>{{item.RoleDec}}</dd>
                        </dl>
                        <div>

                            <!-- Nav tabs -->
                            <ul class="nav nav-tabs" role="tablist">
                                <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">角色人员</a></li>
                                <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">角色权限</a></li>

                            </ul>

                            <!-- Tab panes -->
                            <div class="tab-content">
                                <div role="tabpanel" class="tab-pane active fade in" id="home" style="padding-top:20px">
                                    <div class="pCard" ms-attr-username="el.UserName" ms-repeat-el="item.UserRoleList">
                                        <img class="pHead" alt="" src="/images/TX/default.png">
                                        <div class="pName">{{el.UserRealName}}</div>
                                    </div>

                                </div>
                                <div role="tabpanel" class="tab-pane fade" id="profile">角色权限</div>

                            </div>

                        </div>
                    </div>
                </div>

            </div>

        </div>
    </div>

</body>

</html>